package org.goldenport.g3

import org.goldenport._
import org.goldenport.application.GApplicationDescriptor
import org.goldenport.service._
import org.goldenport.entity._
import org.goldenport.entities.csv._
import org.goldenport.entities.xmind._

/**
 * @since   May.  8, 2010
 * @version Dec.  5, 2011
 * @author  ASAMI, Tomoharu
 */
class G3(args: Array[String]) {
  def revisedargs(as: Array[String]) = {
    if (as.isEmpty) as
    else if (as.exists(_ == "-help")) as
    else ("-g3" :: as.toList).toArray
  }

  val goldenport = new Goldenport(revisedargs(args), G3Descriptor)

  final def executeShellCommand(args: Array[String]) {
    goldenport.open()
    goldenport.executeShellCommand(revisedargs(args))
    goldenport.close()
  }
}

object G3Main {
  def main(args: Array[String]) {
    val g3 = new G3(args)
    g3.executeShellCommand(args)
  }
}

object G3Descriptor extends GApplicationDescriptor {
  name = "g3"
  version = "0.2.2"
  version_build = "20111206"
  copyright_years = "2010,2011"
  copyright_owner = "ASAMI, Tomoharu"
  command_name = "g3"
  //
  classpath("target/classes")
  entities(CsvEntity, XMindEntity)
  services(G3Service)
}
